//
//  RadioCell.m
//  口袋
//
//  Created by dllo on 15/5/29.
//  Copyright (c) 2015年 口袋. All rights reserved.
//

#import "RadioCell.h"
#import "DKNightVersion.h"
#define WIDTH [UIScreen mainScreen].bounds.size.width
#define HEIGHT [UIScreen mainScreen].bounds.size.height/6.67
@implementation RadioCell
- (void)dealloc
{
    [_titleLabel release];
    [_sourceLabel release];
    [_headView release];
    [_hear release];
    [_hearLabel release];
    [super dealloc];
    
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createCell];
        [self createLabel];
        [DKNightVersionManager addClassToSet:self.class];
        self.nightBackgroundColor = UIColorFromRGB(0x343434);
    }
    return self;
}

- (void)createCell
{
    self.headView = [[UIImageView alloc]initWithFrame:CGRectMake(HEIGHT * 0.1, HEIGHT * 0.15, HEIGHT, HEIGHT)];
    self.headView.backgroundColor = [UIColor colorWithRed:118/255.0 green:210/255.0 blue:245/255.0 alpha:1.0];
    self.headView.nightBackgroundColor = UIColorFromRGB(0x343434);
    [self.headView setImage:[UIImage imageNamed:@"playBack.png"]];
    [self.contentView addSubview:self.headView];
    [self.headView release];
}

- (void)createLabel
{
    self.titleLabel = [[UILabel alloc]init];
   // [self.titleLabel setBackgroundColor:[UIColor lightGrayColor]];
    
    UIImageView *icon = [[UIImageView alloc]initWithFrame:CGRectMake(self.titleLabel.frame.origin.x, self.titleLabel.frame.origin.y + self.titleLabel.frame.size.height + 0.025 * WIDTH, 0.06 * WIDTH, 0.035 * WIDTH)];
    [icon setImage:[UIImage imageNamed:@"dingdang.png"]];
    [self.contentView addSubview:icon];
    [icon release];
    
    self.hear = [[UIImageView alloc]init];
    [self.hear setImage:[UIImage imageNamed:@"hear.png"]];
    [self.contentView addSubview:self.hear];
    [self.hear release];
    
    self.hearLabel = [[UILabel alloc]init];
    self.hearLabel.font = [UIFont systemFontOfSize:15];
    self.hearLabel.textColor = [UIColor grayColor];
    [self.contentView addSubview:self.hearLabel];
    [self.hearLabel release];
    
    self.sourceLabel = [[UILabel alloc]init];
    self.sourceLabel.font = [UIFont systemFontOfSize:15];
    self.sourceLabel.textColor = [UIColor grayColor];
   // [self.sourceLabel setBackgroundColor:[UIColor lightGrayColor]];
    self.titleLabel.nightTextColor = [UIColor lightGrayColor];
    [self addSubview:self.titleLabel];
    [self.titleLabel release];
    [self.contentView addSubview:self.sourceLabel];
    [self.sourceLabel release];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
